﻿@using Mes5GService.Web.Areas.AppAreaName.Models.Common.Modals
@model Mes5GService.Notifications.Dto.GetNotificationSettingsOutput
<div>
    @await Html.PartialAsync("~/Areas/AppAreaName/Views/Common/Modals/_ModalHeader.cshtml", new ModalHeaderViewModel(L("NotificationSettings")))
    <div class="modal-body">
        <form name="NotificationSettingsForm" role="form" novalidate class="form">
            <h5>@L("ReceiveNotifications")</h5>
            <div class="form-group">
                <span class="switch mb-5">
                    <label>
                        <input type="checkbox"
                               id="NotificationSettigs_ReceiveNotifications"
                               class="make-switch"
                               @Html.Raw(!Model.ReceiveNotifications ? "" : "checked=\"checked\"")
                               data-on-text="@L("On")"
                               data-off-text="@L("Off")" />
                        <span></span>
                    </label><br />
                </span>
                <span class="form-text text-muted">@L("ReceiveNotifications_Definition")</span>
            </div>

            <h5 class="@($"{(Model.Notifications.Count > 0 ? "" : "hidden")}") notification-types-header margin-top-20">@L("NotificationTypes")</h5>
            <p class="@($"{(Model.Notifications.Count > 0 && !Model.ReceiveNotifications ? "" : "d-none")}") text-danger disable-info"><small>@L("ReceiveNotifications_DisableInfo")</small></p>

            @foreach (var notification in Model.Notifications)
            {
                <div class="checkbox-inline">
                    <div class="notification">
                        <label for="@($"Notification_{notification.Name}")" class="checkbox checkbox-outline">
                            <input id="@($"Notification_{notification.Name}")" type="checkbox" value="true" @(notification.IsSubscribed ? "checked=\"checked\"" : "") @(!Model.ReceiveNotifications ? "disabled" : "") />
                            @notification.DisplayName
                            <span></span>
                        </label>
                        @if (!string.IsNullOrEmpty(notification.Description))
                        {
                            <span class="form-text text-muted">@notification.Description</span>
                        }
                    </div>
                </div>
            }
        </form>

    </div>
    @await Html.PartialAsync("~/Areas/AppAreaName/Views/Common/Modals/_ModalFooterWithSaveAndCancel.cshtml")
</div>
